import java.util.Arrays;

public class Test {
    public static void main() {
        int[] arr = { 1, 6, 8, 9, 2 };
        // 冒泡排序
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        System.err.println(Arrays.toString(arr));

        int[] numbers = { 1, 2, 3, 5, 4 };
        // 对数组排序实际上修改了数组本身
        Arrays.sort(numbers); 
        System.err.println(Arrays.toString(numbers));
    }
}